﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Benefit.Models.View
{
    /// <summary>
    /// 交易员月Tick盈利，亏损情况
    /// </summary>
    public class OperatorMonthTradeInfo
    {
        public List<OperatorMonthTradeInfoData> Datas { get; set; }
        ///// <summary>
        ///// 根据关键字查询交易员当天分时情况
        ///// </summary>
        ///// <param name="pdate">查询日期</param>
        ///// <param name="operatorid">操作员编号</param>
        ///// <param name="key">profit？手续费？</param>
        //public List<OperatorMonthTradeInfoData> GetOperatorMonthTradeInfo(int year, int month, int operatorid, string key, DB.DBManager db)
        //{
        //    List<OperatorMonthTradeInfoData> data = new List<OperatorMonthTradeInfoData>();
        //    var query = db.TradeHistorys.Where(a => a.YPdate == year).Where(a => a.MPdate == month);
        //    foreach (Sys.TradeHistory t in query)
        //    {
        //        List<OperatorDayTradeInfoData> dayInfos = new OperatorDayTradeInfo().GetOperatorDayTradeInfo(t.Id, operatorid, key, db).Datas;
        //        foreach (OperatorDayTradeInfoData d in dayInfos)
        //        {
        //            var queryExist = data.Where(a => a.Clock == d.Clock);
        //            if (queryExist.Count() > 0)
        //            {
        //                queryExist.First().BillCount += d.BillCount;
        //                queryExist.First().Percent += d.Percent;
        //                queryExist.First().SumValue += d.SumValue;
        //            }
        //            else
        //            {
        //                OperatorMonthTradeInfoData _data = new OperatorMonthTradeInfoData();
        //                _data.BillCount = d.BillCount;
        //                _data.Clock = d.Clock;
        //                _data.OperatorId = operatorid;
        //                _data.Percent = d.Percent;
        //                _data.SumValue = d.SumValue;
        //                data.Add(_data);
        //            }
        //        }
        //    }
        //    return data;
        //}
    }

   
}
